package com.cyms.modules.order.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.cyms.modules.order.entity.OrderCarAmountEntity;
import com.cyms.modules.order.service.OrderCarAmountService;
import com.cyms.common.utils.PageUtils;
import com.cyms.common.utils.R;



/**
 * 派车付款项目
 *
 * @author low
 * @email tolower@foxmail.com
 * @date 2018-12-19 00:49:45
 */
@RestController
@RequestMapping("order/ordercaramount")
public class OrderCarAmountController {
    @Autowired
    private OrderCarAmountService orderCarAmountService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("order:ordercaramount:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderCarAmountService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("order:ordercaramount:info")
    public R info(@PathVariable("id") Long id){
			OrderCarAmountEntity orderCarAmount = orderCarAmountService.selectById(id);

        return R.ok().put("orderCarAmount", orderCarAmount);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("order:ordercaramount:save")
    public R save(@RequestBody OrderCarAmountEntity orderCarAmount){
			orderCarAmountService.insert(orderCarAmount);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("order:ordercaramount:update")
    public R update(@RequestBody OrderCarAmountEntity orderCarAmount){
			orderCarAmountService.updateById(orderCarAmount);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("order:ordercaramount:delete")
    public R delete(@RequestBody Long[] ids){
			orderCarAmountService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

}
